package com.wuxiaoge.dao;

import com.wuxiaoge.entity.Device2400;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface Device2400Repository extends JpaRepository<Device2400,Long>, JpaSpecificationExecutor<Device2400> {


    List<Device2400> findDevice2400ByDeviceName(String name);

    @Query(value = "select * from t_device_2400  where device_name =:deviceName",nativeQuery = true)
    List<Device2400> getByName(@Param("deviceName")String deviceName);

    List<Device2400> getDevice2400sByDeviceNameOrderByBatchIdDesc(String deviceName);

    //这是使用正常的 sql 语句去查询
    // :name 是通过 @Param 注解去确定的
//    @Query(nativeQuery = true,value = "select * from t_device_2400 c where c.device_name =:name")
//    List<Device2400> findDeviceRoom2(@Param("name")String name);

}
